<template>
	<view class="pages">
		<!-- 模块1 -->
		<view class="items">
			<view class="items_h">
				<view class="items_h_left fineFontSytle" style="width: 50%;">
					<!-- Policy Number -->
					{{$t('PoliciesDtalis.PolicyNumber')}}
				</view>
				<view class="items_h_right strongFontSytle" style="width: 50%;">
					<!-- LS15673928 -->
					{{dtailsData.list[0].number.number || ''}}
				</view>
			</view>
			<view class="items_h">
				<view class="items_h_left fineFontSytle" style="width: 50%;">
					<!-- Insured Name -->
					{{$t('PoliciesDtalis.InsuredName')}}
				</view>
				<view class="items_h_right strongFontSytle" style="width: 50%;">
					{{dtailsData.list[0].protect_user || ''}}
				</view>
			</view>
			<view class="items_h">
				<view class="items_h_left fineFontSytle" style="width: 50%;">
					<!-- Product Company -->
					{{$t('PoliciesDtalis.ProductCompany')}}
				</view>
				<view class="items_h_right strongFontSytle" style="width: 50%;">
					{{dtailsData.list[0].bx_company || ''}}
				</view>
			</view>
			<view class="items_h">
				<view class="items_h_left fineFontSytle" style="width: 50%;">
					<!-- Product Name -->
					{{$t('PoliciesDtalis.ProductName')}}
				</view>
				<view class="items_h_right strongFontSytle" style="width: 50%;">
					{{dtailsData.list[0].product.title || ''}}
				</view>
			</view>
			<view class="items_h">
				<view class="items_h_left fineFontSytle" style="width: 50%;">
					<!-- Face Amount -->
					{{$t('PoliciesDtalis.FaceAmount')}}
				</view>
				<view class="items_h_right strongFontSytle" style="width: 50%;">
				
					${{$formatNumberWithCommas(CommissionDetailData.money ? CommissionDetailData.money : 0)}}
				</view>
			</view>
			<view class="items_h">
				<view class="items_h_left fineFontSytle" style="width: 50%;">
					Total TP
				</view>
				<view class="items_h_right strongFontSytle" style="width: 50%;">
					<!-- 111110000000000 -->
					${{$formatNumberWithCommas(CommissionDetailData.order_tp ? CommissionDetailData.order_tp : 0)}}
				</view>
			</view>
			<view class="items_h">
				<view class="items_h_left fineFontSytle" style="width: 50%;">
					<!-- Paid Commission -->
					{{$t('PaidCommissiondetails')}}
				</view>
				<view class="items_h_right strongFontSytle" style="width: 50%;">
					${{$formatNumberWithCommas(CommissionDetailData.all_money ? CommissionDetailData.all_money : 0 )}}
				</view>
			</view>
			<view class="items_h">
				<view class="items_h_left fineFontSytle" style="width: 50%;">
					<!-- Status -->
					{{$t('zhifuzhuangtai')}}
				</view>
				<view class="items_h_right strongFontSytle" style="width: 50%;">
					<view class="Status">
						{{CommissionDetailData.status == 3 ?  "active" : "completed"}}
					</view>
				</view>
			</view>
		</view>
		<!-- 三个列表 -->
		<view class="items funBox">
			<view class="items_li" @click="$next('/pages/Commission/PersonalCommission',commissionDetails.id)">
				{{$t('PersonalCommissionss')}}
			</view>
			<view class="items_li" @click="$next('/pages/Commission/LevelCommission',commissionDetails.id)">
				{{$t('LevelCommissionss')}}
			</view>
			<view class="items_li" @click="$next('/pages/Commission/OverrideCommission',commissionDetails.id)">
				{{$t('OverrideCommissionss')}}
			</view>
		</view>
		<!-- 模块2 -->
		<view class="items">
			<view class="items_bh fineFontSytle">
				<view class="items_bh_list">
					<!-- Agent Name -->
					{{$t('AddNewPolicy.AgentName')}}
				</view>
				<view class="items_bh_list">
					<!-- Agent Code -->
					{{$t('AgentCode')}}
				</view>
				<view class="items_bh_list">
					<!-- Level -->
					{{$t('Level')}}
					
				</view>
			</view>

			<view class="items_bh strongFontSytle" v-for="(list , index) in dtailsData.list">
				<view class="items_bh_list">
					{{list.user.real_name || ''}}
				</view>
				<view class="items_bh_list">
					{{list.user.id || ''}}
				</view>
				<view class="items_bh_list">
					{{list.user.level || ''}}
				</view>
			</view>
		</view>
	
		<!-- 模块3 -->
		<view class="items">
			<view class="modelTherr fineFontSytle">
				<!-- Payment History -->
				{{$t('PaymentHistory')}}
			</view>
			<view class="dataContent" v-for="(payitems , index) in dtailsData.pay">
				<view class="line" v-if="index != 0">
					<!-- 线 -->
				</view>
				<view class="items_ch">
					<view class="items_ch_left " style="width: 50%;">
						<view class="items_ch_left_top fineFontSytle" >
							<!-- Agent Name -->
							{{$t('CommissionDtails.AgentName')}}
						</view>
						<view class="items_ch_left_buttom strongFontSytle">
							<!-- Creative Atlas -->
							{{payitems.real_name || ''}}
						</view>
					</view>
					<view class="items_ch_right" style="width: 50%;">
						<view class="items_ch_right_top fineFontSytle">
							<!-- Agent Level -->
							{{$t('CommissionDtails.AgentLevel')}}
						</view>
						<view class="items_ch_right_buttom  strongFontSytle">
							<!-- EP -->
							{{payitems.level || ''}}
						</view>
					</view>
				</view>
				<view class="items_ch">
					<view class="items_ch_left" style="width: 50%;">
						<view class="items_ch_left_top fineFontSytle" >
							<!-- Payment TP -->
							{{$t('CommissionDtails.PaymentTP')}}
						</view>
						<view class="items_ch_left_buttom strongFontSytle">
							<!-- 4930.73 -->
							${{ $formatNumberWithCommas(payitems.pay_tp ? payitems.pay_tp : 0)}}
						</view>
					</view>
					<view class="items_ch_right" style="width: 50%;">
						<view class="items_ch_right_top fineFontSytle">
							<!-- Type -->
							{{$t('CommissionDtails.Type')}}
						</view>
						<view class="items_ch_right_buttom strongFontSytle">
							<!-- First Year -->
							{{payitems.cate_name || ''}}
						</view>
					</view>
				</view>
				<view class="items_ch">
					<view class="items_ch_left" style="width: 50%;">
						<view class="items_ch_left_top fineFontSytle">
							<!-- Commission Paid -->
							{{$t('PaidCommissiondetails')}}
						</view>
						<view class="items_ch_left_buttom strongFontSytle">
							<!-- $277.69 -->
							${{ $formatNumberWithCommas(payitems.income ? payitems.income : 0)}}
						</view>
					</view>
					<view class="items_ch_right" style="width: 50%;">
						<view class="items_ch_right_top fineFontSytle">
							<!-- Payment Date -->
							{{$t('CommissionDtails.PaymentDate')}}
						</view>
						<view class="items_ch_right_buttom strongFontSytle">
							<!-- 08-09-2023 -->
							{{payitems.pay_time | formatter('yyyy-mm-dd')}}
						</view>
					</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {

		data() {
			return {
				order_id:null,
				newUrl:1,//0为新接口1为老接口
				CommissionDetailData: {},
				dtailsData:{}
			}
		},
		onLoad(options) {
		
			this.CommissionDetailData = {
				...this.commissionDetails
			}
			this.getDtailsData(this.commissionDetails.id)
		},
		computed: {
		  commissionDetails() {
		    return this.$store.getters.CommissionDtails;
		  }
		},
		methods: {
				// 获取详情数据
				getDtailsData(id) {
					uni.showLoading({
						title: this.$t('Laoding'),
					})
					this.$get('/backend/user-income/detail',{
						order_id:id
					},this.newUrl).then(res => {
						this.dtailsData = res.data.data
						console.log(res,'支付历史记录');
					})
				}

		}
	}
</script>

<style>
	.pages {
		width: 100%;
		height: 100vh;
		overflow-y: auto;
		/* padding: 0 26rpx; */
		box-sizing: border-box;
		background-color: #F0F0F0;
		padding: 30rpx 25rpx 120rpx;
		box-sizing: border-box;
	}

	.items {
		overflow: auto;
		width: 100%;
		background-color: #fff;
		padding: 54rpx 32rpx 85rpx;
		box-sizing: border-box;
		margin-bottom: 20rpx;
		border-radius: 10rpx;
	}

	.items_h {
		display: flex;
		align-items: center;
		margin-top: 20rpx;
		/* background-color: red; */
	}

	.items_h:first-child {
		margin-top: 0rpx;
	}

	.items_h_left {}

	.strongFontSytle {
		font-family: Montserrat;
		font-size: 28rpx;
		font-weight: 700;
		letter-spacing: 0em;
		text-align: left;

	}

	.fineFontSytle {
		font-family: Montserrat;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 22px;
		letter-spacing: 0em;
		text-align: left;

	}

	.Status {
		display: inline-block;
		height: 40rpx;
		line-height: 36rpx;
		background-color: #73E11D;
		padding: 0 20rpx;
		font-family: Inter;
		font-size: 24rpx;
		font-weight: 700;
		letter-spacing: 0em;
		text-align: center;
		color: #fff;
		border-radius: 20rpx;

	}

	.items_bh {
		display: flex;
		align-items: center;
		margin-top: 20rpx;

	}

	.items_bh:first-child {
		margin-top: 0;
	}

	.items_bh_list {
		width: 250rpx;
	}
	.items_ch {
		display: flex;
		align-items: center;
	}
	.items_ch_left_buttom,.items_ch_right_buttom {
		margin-top: 10rpx;
	}
	.items_ch {
		margin-top: 35rpx;
	}
	.items_ch:first-child {
		margin-top: 0;
	}
	.line {
		width: 100%;
		height: 2rpx;
		background-color: #808080;
		margin-top: 35rpx;
	}
	.modelTherr {
		width: 100%;
		margin-bottom: 35rpx;
	}
	.funBox {
		display: flex;
		align-items: center;
		align-items: center;
		flex-direction: column;
	}
	.items_li {
		width: 100%;
		height: 60rpx;
		border: 2rpx solid #273562;
		border-radius: 30rpx;
		text-align: center;
		line-height: 53rpx;
		margin-top: 25rpx;
		background-color: #273562;
		color: #fff;
	}
	.items_li:active {
		background-color: #384d8d;
	}
</style>